<?php
('Access-Control-Allow-Origin：*');
include("../config/mysql.php");
$db = new mysql();
$type = $_REQUEST["type"];
$company_id = $_REQUEST["company_id"];
$uploadPath = "D:/wwwroot/127.0.0.1/mobileManage/upload/" . $_FILES["file"]["name"];

if (!file_exists($uploadPath)) {
    move_uploaded_file($_FILES["file"]["tmp_name"], $uploadPath);
    $file_path = "/mobileManage/upload/" . $_FILES["file"]["name"];
    $sql = "INSERT INTO files (`file_name`,file_path,`type`,company_id) VALUES ('{$_FILES["file"]["name"]}','{$file_path}',{$type},{$company_id})";
    echo $db->Query($sql);
} else {
    echo 'file is existence';
}

$db->close();
